#include <stdio.h>
#include <algorithm>
#include <string.h>
using namespace std;

#define rep(i,n) for (int i=0; i<n; i++)

#define TRACE(x...) x
#define PRINT(x...) TRACE(printf(x))

#define MULT_TEST(x...) 

int _42;
char key[5][5];
int fl;
int sym[3] = {2, 1, 0};

int main() {
	MULT_TEST(
		scanf("%d", &_42);

		while (_42--) {
	)

	fl=0;
	rep(i,3) scanf(" %s", key[i]);

	rep(i,3) {
		rep(j,3) {
			if (key[i][j]!=key[sym[i]][sym[j]]) {
				printf("NO\n");
				MULT_TEST(
					fl=1; break;
				)
				return 0;
			}
		}

		if (fl) break;
	}

	if (!fl) printf("YES\n");

	MULT_TEST( } )
	
	return 0;
}
